<!--
 * @Description: Echarts-系列
 * @Author: rendc
 * @Date: 2025-11-17 11:25:22
 * @LastEditors: rendc
 * @LastEditTime: 2025-11-17 14:32:04
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Echarts图表 - 系列</title>
  <!-- 相对路径 -->
  <script src="./js/echarts.js"></script>
  <style>
    .echartDiv{
      border: 1px solid red;
    }
  </style>
</head>
<body>
  Echarts
  <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
  <div id="main" class="echartDiv" style="width: 600px;height:400px;"></div>
  <script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例对象myChart
    var myChart = echarts.init(document.getElementById('main'));
    // 准备option
    var option = {
      // 图例
      legend: {
        type: 'scroll',
        top:0,
      },
      xAxis: {
        type: 'category',
        data: ['Matcha ', 'Milk ', 'Cheese ', ' Brownie']
      },
      yAxis: {},
      series: [
        {
          type: 'line',
          name: '2015',
          data: [89.3, 92.1, 94.4, 85.4]
        },
        {
          type: 'bar',
          name: '2016',
          data: [95.8, 89.4, 91.2, 76.9]
        }
      ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
  </script>
</body>
</html>